package com.UI
{
	import com.*;
	import com.Engine.*;
	import com.Packet.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	
	import gs.*;
	import gs.easing.*;
	import gs.events.TweenEvent;
	
	import org.aswing.*;
	import org.aswing.border.*;
	import org.aswing.border.EmptyBorder;
	import org.aswing.colorchooser.*;
	import org.aswing.dnd.*;
	import org.aswing.event.*;
	import org.aswing.ext.*;
	import org.aswing.geom.*;
	import org.aswing.tree.AbstractLayoutCache;
	public class FrameMall extends JFrame
	{
		//members define
		private var panel3:JPanel;
		private var panel14:JPanel;
		private var btn_mall_tab_ingot:JToggleButton;
		private var btn_mall_tab_money:JToggleButton;
		private var btn_mall_tab_honour:JToggleButton;
		private var labelCurrentText:JLabel;
		private var labelCurrent:JLabel;
		private var panel15:JPanel;
		private var panel32:JPanel;
		private var btn_mall_tab_home:JToggleButton;
		private var btn_mall_tab_gem:JToggleButton;
		private var btn_mall_tab_pet:JToggleButton;
		private var btn_mall_tab_consume:JToggleButton;
		private var btn_mall_tab_vip:JToggleButton;
		private var btn_mall_tab_gift:JToggleButton;
		private var btn_mall_tab_other:JToggleButton;
		private var panelItems:JPanel;
		private var panelBCenter:JPanel;
		private var btnPrev:JButton;
		private var labelPage:JLabel;
		private var btnNext:JButton;
		
		private var btn_close:JButton;
		public function FrameMall()
		{
			setClosable(false);
			setResizable(false);  
			setBorder(new EmptyBorder());
			btn_close = new JButton();
			btn_close.setLocation(new IntPoint(453, 8));
			btn_close.setSize(new IntDimension(27, 27));
			btn_close.setPreferredSize(new IntDimension(27, 27));
			this.getTitleBar().setCloseButton(btn_close);
			this.getTitleBar().setMinimizeHeight(32);
			this.setClipMasked(false);
			
			//component creation
			setSize(new IntDimension(513, 395));
			setPreferredSize(new IntDimension(513, 395));
			var layout0:EmptyLayout = new EmptyLayout();
			getContentPane().setLayout(layout0);
			
			panel3 = new JPanel();
			panel3.setLocation(new IntPoint(0, 2));
			panel3.setSize(new IntDimension(513, 33));
			panel3.setPreferredSize(new IntDimension(513, 33));
			var layout1:EmptyLayout = new EmptyLayout();
			panel3.setLayout(layout1);
			
			panel14 = new JPanel();
			panel14.setLocation(new IntPoint(20, 1));
			panel14.setSize(new IntDimension(249, 32));
			panel14.setPreferredSize(new IntDimension(249, 32));
			var layout2:FlowLayout = new FlowLayout();
			layout2.setAlignment(AsWingConstants.CENTER);
			layout2.setHgap(1);
			layout2.setVgap(0);
			layout2.setMargin(false);
			panel14.setLayout(layout2);
			
			btn_mall_tab_ingot = new JToggleButton();
			btn_mall_tab_ingot.setLocation(new IntPoint(30, 0));
			btn_mall_tab_ingot.setSize(new IntDimension(82, 29));
			btn_mall_tab_ingot.setPreferredSize(new IntDimension(82, 32));
			btn_mall_tab_ingot.setText("元宝商店");
			
			btn_mall_tab_money = new JToggleButton();
			btn_mall_tab_money.setLocation(new IntPoint(82, 1));
			btn_mall_tab_money.setSize(new IntDimension(82, 29));
			btn_mall_tab_money.setPreferredSize(new IntDimension(82, 32));
			btn_mall_tab_money.setText("铜币商店");
			
			btn_mall_tab_honour = new JToggleButton();
			btn_mall_tab_honour.setLocation(new IntPoint(164, 0));
			btn_mall_tab_honour.setSize(new IntDimension(82, 32));
			btn_mall_tab_honour.setPreferredSize(new IntDimension(82, 32));
			btn_mall_tab_honour.setText("荣誉商店");
			
			labelCurrentText = new JLabel();
			labelCurrentText.setLocation(new IntPoint(329, 8));
			labelCurrentText.setSize(new IntDimension(70, 18));
			labelCurrentText.setPreferredSize(new IntDimension(70, 18));
			labelCurrentText.setText("当前元宝:");
			
			labelCurrent = new JLabel();
			labelCurrent.setLocation(new IntPoint(399, 8));
			labelCurrent.setSize(new IntDimension(100, 18));
			labelCurrent.setPreferredSize(new IntDimension(100, 18));
			labelCurrent.setText("label");
			labelCurrent.setHorizontalAlignment(AsWingConstants.LEFT);
			
			panel15 = new JPanel();
			panel15.setLocation(new IntPoint(0, 35));
			panel15.setSize(new IntDimension(513, 35));
			panel15.setPreferredSize(new IntDimension(513, 35));
			var layout3:FlowLayout = new FlowLayout();
			layout3.setAlignment(AsWingConstants.LEFT);
			layout3.setHgap(10);
			layout3.setVgap(5);
			layout3.setMargin(true);
			panel15.setLayout(layout3);
			
			panel32 = new JPanel();
			panel32.setLocation(new IntPoint(5, 5));
			panel32.setSize(new IntDimension(420, 25));
			panel32.setPreferredSize(new IntDimension(420, 25));
			var layout4:FlowWrapLayout = new FlowWrapLayout();
			layout4.setPreferWidth(200);
			layout4.setAlignment(AsWingConstants.LEFT);
			layout4.setHgap(2);
			layout4.setVgap(0);
			layout4.setMargin(true);
			panel32.setLayout(layout4);
			
			btn_mall_tab_home = new JToggleButton();
			btn_mall_tab_home.setLocation(new IntPoint(5, 5));
			btn_mall_tab_home.setSize(new IntDimension(58, 25));
			btn_mall_tab_home.setPreferredSize(new IntDimension(58, 25));
			btn_mall_tab_home.setText("label");
			
			btn_mall_tab_gem = new JToggleButton();
			btn_mall_tab_gem.setLocation(new IntPoint(68, 5));
			btn_mall_tab_gem.setSize(new IntDimension(58, 25));
			btn_mall_tab_gem.setPreferredSize(new IntDimension(58, 25));
			btn_mall_tab_gem.setText("label");
			
			btn_mall_tab_pet = new JToggleButton();
			btn_mall_tab_pet.setLocation(new IntPoint(122, 0));
			btn_mall_tab_pet.setSize(new IntDimension(58, 25));
			btn_mall_tab_pet.setPreferredSize(new IntDimension(58, 25));
			btn_mall_tab_pet.setText("label");
			
			btn_mall_tab_consume = new JToggleButton();
			btn_mall_tab_consume.setLocation(new IntPoint(182, 0));
			btn_mall_tab_consume.setSize(new IntDimension(58, 25));
			btn_mall_tab_consume.setPreferredSize(new IntDimension(58, 25));
			btn_mall_tab_consume.setText("label");
			
			btn_mall_tab_vip = new JToggleButton();
			btn_mall_tab_vip.setLocation(new IntPoint(242, 0));
			btn_mall_tab_vip.setSize(new IntDimension(58, 25));
			btn_mall_tab_vip.setPreferredSize(new IntDimension(58, 25));
			btn_mall_tab_vip.setText("label");
			
			btn_mall_tab_gift = new JToggleButton();
			btn_mall_tab_gift.setLocation(new IntPoint(302, 0));
			btn_mall_tab_gift.setSize(new IntDimension(58, 25));
			btn_mall_tab_gift.setPreferredSize(new IntDimension(58, 25));
			btn_mall_tab_gift.setText("label");
			
			btn_mall_tab_other = new JToggleButton();
			btn_mall_tab_other.setLocation(new IntPoint(362, 0));
			btn_mall_tab_other.setSize(new IntDimension(58, 25));
			btn_mall_tab_other.setPreferredSize(new IntDimension(58, 25));
			btn_mall_tab_other.setText("label");
			
			panelItems = new JPanel();
			panelItems.setLocation(new IntPoint(12, 73));
			panelItems.setSize(new IntDimension(486, 264));
			panelItems.setPreferredSize(new IntDimension(486, 264));
			var layout5:GridLayout = new GridLayout();
			layout5.setRows(3);
			layout5.setColumns(3);
			layout5.setHgap(0);
			layout5.setVgap(0);
			panelItems.setLayout(layout5);
			
			panelBCenter = new JPanel();
			panelBCenter.setLocation(new IntPoint(204, 350));
			panelBCenter.setSize(new IntDimension(104, 24));
			panelBCenter.setPreferredSize(new IntDimension(104, 24));
			var layout6:FlowLayout = new FlowLayout();
			layout6.setAlignment(AsWingConstants.CENTER);
			layout6.setHgap(5);
			layout6.setVgap(0);
			layout6.setMargin(false);
			panelBCenter.setLayout(layout6);
			
			btnPrev = new JButton();
			btnPrev.setLocation(new IntPoint(5, 5));
			btnPrev.setSize(new IntDimension(31, 23));
			btnPrev.setPreferredSize(new IntDimension(29, 24));
			btnPrev.setText("上一页");
			
			labelPage = new JLabel();
			labelPage.setLocation(new IntPoint(39, 4));
			labelPage.setSize(new IntDimension(36, 16));
			labelPage.setPreferredSize(new IntDimension(36, 16));
			labelPage.setText("label");
			
			btnNext = new JButton();
			btnNext.setLocation(new IntPoint(75, 0));
			btnNext.setSize(new IntDimension(29, 24));
			btnNext.setPreferredSize(new IntDimension(29, 24));
			btnNext.setText("下一页");
			
			//component layoution
			getContentPane().append(panel3);
			getContentPane().append(panel15);
			getContentPane().append(panelItems);
			getContentPane().append(panelBCenter);
			
			panel3.append(panel14);
			panel3.append(labelCurrentText);
			panel3.append(labelCurrent);
			
			panel14.append(btn_mall_tab_ingot);
			panel14.append(btn_mall_tab_money);
			panel14.append(btn_mall_tab_honour);
			
			panel15.append(panel32);
			
			panel32.append(btn_mall_tab_home);
			panel32.append(btn_mall_tab_gem);
			panel32.append(btn_mall_tab_pet);
			panel32.append(btn_mall_tab_consume);
			panel32.append(btn_mall_tab_vip);
			panel32.append(btn_mall_tab_gift);
			panel32.append(btn_mall_tab_other);
			
			panelBCenter.append(btnPrev);
			panelBCenter.append(labelPage);
			panelBCenter.append(btnNext);
			

			//-------------------------------------
			setImages();
			pack();
			panelItems.setClipMasked(false);
			panelBCenter.setClipMasked(false);
		}
		public static var _frame:FrameMall = null;
		public static function show():void
		{
			
			if(isShowing())
			{
				hide()
				return;
			}
			if(_frame == null)
			{
				_frame = new FrameMall();
				PanelMainHelp.getInstance().addChild(_frame);
			}
			_frame.show();
			PanelMainHelp.getInstance().bringToTop(_frame);
			_frame.x = (Engine.W - _frame.width) / 2;
			_frame.y = (Engine.H - _frame.height) / 2;
			_frame.updatePage(_frame._currentPage);
			
		}
		public static function hide():void
		{
			if(isShowing())_frame.hide();
		}
		public static function isShowing():Boolean
		{
			return(_frame != null&& _frame.isShowing());
		}
		private var _mallItems:Array = new Array();
		public function setImages():void
		{
			var img_background:DisplayObject = Client.getUIElement("img_mall_bg") as DisplayObject
			setBackgroundDecorator(new AssetBackground(img_background));
			//setSizeWH(img_background.width,img_background.height);
			setSize(new IntDimension(img_background.width, img_background.height));
			setPreferredSize(new IntDimension(img_background.width, img_background.height));
			setLocationXY((Engine.W - img_background.width) / 2,(Engine.H - img_background.height)/2);
			btn_close.wrapSimpleButton(Client.getUIElement("btn_close") as SimpleButton);
			
			btn_mall_tab_ingot.wrapSimpleButton(Client.getUIElement("btn_mall_tab_ingot") as SimpleButton);
			btn_mall_tab_ingot.setText("");
			btn_mall_tab_money.wrapSimpleButton(Client.getUIElement("btn_mall_tab_money") as SimpleButton);
			btn_mall_tab_money.setText("");
			btn_mall_tab_honour.wrapSimpleButton(Client.getUIElement("btn_mall_tab_honour") as SimpleButton);
			btn_mall_tab_honour.setText("");
			
			btn_mall_tab_home.wrapSimpleButton(Client.getUIElement("btn_mall_tab_home") as SimpleButton);
			btn_mall_tab_home.setText("");
			btn_mall_tab_gem.wrapSimpleButton(Client.getUIElement("btn_mall_tab_gem") as SimpleButton);
			btn_mall_tab_gem.setText("");
			btn_mall_tab_pet.wrapSimpleButton(Client.getUIElement("btn_mall_tab_pet") as SimpleButton);
			btn_mall_tab_pet.setText("");
			btn_mall_tab_consume.wrapSimpleButton(Client.getUIElement("btn_mall_tab_consume") as SimpleButton);
			btn_mall_tab_consume.setText("");
			btn_mall_tab_vip.wrapSimpleButton(Client.getUIElement("btn_mall_tab_vip") as SimpleButton);
			btn_mall_tab_vip.setText("");
			btn_mall_tab_gift.wrapSimpleButton(Client.getUIElement("btn_mall_tab_gift") as SimpleButton);
			btn_mall_tab_gift.setText("");
			btn_mall_tab_other.wrapSimpleButton(Client.getUIElement("btn_mall_tab_other") as SimpleButton);
			btn_mall_tab_other.setText("");

			btnPrev.setText("");
			btnNext.setText("");
			
			btnPrev.wrapSimpleButton(Client.getUIElement("btn_prev") as SimpleButton);
			btnNext.wrapSimpleButton(Client.getUIElement("btn_next") as SimpleButton);
			
			btn_mall_tab_ingot.setSelected(true);
			var group:ButtonGroup = new ButtonGroup();
			group.appendAll(btn_mall_tab_ingot,btn_mall_tab_money,btn_mall_tab_honour);
			
			btn_mall_tab_ingot.addActionListener(onTabIngot);
			btn_mall_tab_money.addActionListener(onTabMoney);
			btn_mall_tab_honour.addActionListener(onTabHonour);
			
			btn_mall_tab_home.setSelected(true);
			group = new ButtonGroup();
			group.appendAll(btn_mall_tab_home,btn_mall_tab_gem,btn_mall_tab_pet,btn_mall_tab_consume,btn_mall_tab_vip,btn_mall_tab_gift,btn_mall_tab_other);
			
			btn_mall_tab_home.addActionListener(onTabHome);
			btn_mall_tab_gem.addActionListener(onTabGem);
			btn_mall_tab_pet.addActionListener(onTabPet);
			btn_mall_tab_consume.addActionListener(onTabConsume);
			btn_mall_tab_vip.addActionListener(onTabVip);
			btn_mall_tab_gift.addActionListener(onTabGift);
			btn_mall_tab_other.addActionListener(onTabOther);
			
			btnPrev.addActionListener(onBtnPrev);
			btnNext.addActionListener(onBtnNext);
			var filter:GlowFilter;
			var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
			filter = new GlowFilter(0x000000, 1, 2, 2, 10);
			labelPage.setForeground(ASColor.WHITE);
			labelPage.setFont(font);
			labelPage.setTextFilters(new Array(filter));
			
			font = new ASFont("宋体", 14, false, false, false, false);
			labelCurrentText.setForeground(ASColor.WHITE);
			labelCurrentText.setFont(font);
			labelCurrentText.setTextFilters(new Array(filter));
			
			labelCurrent.setForeground(ASColor.ORANGE);
			labelCurrent.setFont(font);
			labelCurrent.setTextFilters(new Array(filter));

			for(var i:int = 0; i < _itemsPerPage; i++)
			{
				var item:PaneMallItem = new PaneMallItem;
				panelItems.append(item);
				_mallItems.push(item);
			}
			labelCurrentText.setText("当前元宝:");
			labelCurrent.setText(CharInfo.ingot.toString());
			updatePage(0);
		}
		private function onTabIngot(event:Event):void
		{
			_mall_type = MALL_TYPE_INGOT;
			labelCurrentText.setText("当前元宝:");
			labelCurrent.setText(CharInfo.ingot.toString());
			updatePage(_currentPage);
		}
		private function onTabMoney(event:Event):void
		{
			_mall_type = MALL_TYPE_MONEY;
			labelCurrentText.setText("当前铜币:");
			labelCurrent.setText(CharInfo.money.toString());
			updatePage(_currentPage);
		}
		private function onTabHonour(event:Event):void
		{
			_mall_type = MALL_TYPE_HONOUR;
			labelCurrentText.setText("当前荣誉:");
			labelCurrent.setText(CharInfo.honour.toString());
			updatePage(_currentPage);
		}
		
		private function onTabHome(event:Event):void
		{
			updatePage(0);
		}
		private function onTabGem(event:Event):void
		{
			updatePage(1);
		}
		private function onTabPet(event:Event):void
		{
			updatePage(2);
		}
		private function onTabConsume(event:Event):void
		{
			updatePage(3);
		}
		private function onTabVip(event:Event):void
		{
			updatePage(4);
		}
		private function onTabGift(event:Event):void
		{
			updatePage(5);
		}
		private function onTabOther(event:Event):void
		{
			updatePage(6);
		}
		
		
		private var _currentPage:int = -1;
		private var _currentPageIndex:int = 0;
		private var _currentPageIndexAll:int = 0;
		private var _itemsPerPage:int = 9;
		public static var MALL_TYPE_INGOT:int = 0;
		public static var MALL_TYPE_MONEY:int = 1;
		public static var MALL_TYPE_HONOUR:int = 2;
		public static var _mall_type:int = 0;
		public function updatePage(page:int):void
		{
			for each(var obj:PaneMallItem in _mallItems)
			{
				obj.item = null;
			}
			var _mall:Array = null;
			if(_mall_type == MALL_TYPE_INGOT)
				_mall = Client._MallIngotCSV;
			if(_mall_type == MALL_TYPE_MONEY)
				_mall = Client._MallMoneyCSV;
			if(_mall_type == MALL_TYPE_HONOUR)
				_mall = Client._MallHonourCSV;
			
			if(_currentPageIndex >= Math.floor((_mall.length+_itemsPerPage-1)/_itemsPerPage))
				_currentPageIndex = 0;
			
			var nIndex:int = 0;
			var nCount:int = 0;
			for each(var item:Object in _mall)
			{
				if(item.type == page)
				{
					nCount++;
					if(nCount <= _currentPageIndex*_itemsPerPage)
						continue;
					_mallItems[nIndex++].item = item;
					if(nIndex >= _itemsPerPage)
						break;
				}
			}
			if(_currentPage != page)
			{
				_currentPage = page;
				var nCount1:int = 0;
				for each(var item1:Object in _mall)
				{
					if(item1.type == page)
					{
						nCount1++;
					}
				}
				_currentPageIndex = 0;
				_currentPageIndexAll = Math.floor((nCount1+_itemsPerPage-1)/_itemsPerPage);
				labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
			}

			btnPrev.setEnabled(_currentPageIndex > 0 &&  _currentPageIndexAll > 1);
			btnNext.setEnabled(_currentPageIndex < _currentPageIndexAll-1 &&  _currentPageIndexAll > 1);
		}
		
		private function onBtnPrev(event:Event):void
		{
			_currentPageIndex--;
			if(_currentPageIndex < 0)
				_currentPageIndex = 0;
			else
				updatePage(_currentPage);
			labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
		}
		private function onBtnNext(event:Event):void
		{
			_currentPageIndex++;
			if(_currentPageIndex > _currentPageIndexAll-1)
				_currentPageIndex = _currentPageIndexAll-1;
			else
				updatePage(_currentPage);
			labelPage.setText(_currentPageIndex+1+'/'+_currentPageIndexAll);
		}
	}
}

import com.*;
import com.Engine.*;
import com.Packet.*;
import com.UI.*;

import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;

import org.aswing.*;
import org.aswing.VectorListModel;
import org.aswing.border.*;
import org.aswing.border.EmptyBorder;
import org.aswing.colorchooser.*;
import org.aswing.ext.*;
import org.aswing.geom.*;
import org.aswing.table.*;

/**
 * MyPaneMallItem
 */
class PaneMallItem extends JPanel
{
	
	//members define
	private var labelName:JLabel;
	private var panelIcon:PanelItemCSV;
	private var labelPrice:JLabel;
	private var btnBuy:JButton;
	private var panelType:JPanel;
	
	/**
	 * MyPaneMallItem Constructor
	 */
	private var _item:Object = null;
	public function PaneMallItem()
	{
		//component creation
		setSize(new IntDimension(162, 88));
		setPreferredSize(new IntDimension(162, 88));
		var layout0:EmptyLayout = new EmptyLayout();
		setLayout(layout0);
		
		labelName = new JLabel();
		labelName.setLocation(new IntPoint(60, 10));
		labelName.setSize(new IntDimension(99, 16));
		labelName.setPreferredSize(new IntDimension(99, 16));
		labelName.setText("label");
		labelName.setHorizontalAlignment(AsWingConstants.CENTER);
		
		panelIcon = new PanelItemCSV();
		panelIcon.setLocation(new IntPoint(10, 10));
		panelIcon.setSize(new IntDimension(43, 43));
		panelIcon.setPreferredSize(new IntDimension(43, 43));
		
		labelPrice = new JLabel();
		labelPrice.setLocation(new IntPoint(86, 36));
		labelPrice.setSize(new IntDimension(67, 17));
		labelPrice.setPreferredSize(new IntDimension(67, 17));
		labelPrice.setText("15000000");
		labelPrice.setHorizontalAlignment(AsWingConstants.CENTER);
		
		btnBuy = new JButton();
		btnBuy.setLocation(new IntPoint(56, 63));
		btnBuy.setSize(new IntDimension(49, 25));
		btnBuy.setPreferredSize(new IntDimension(49, 25));
		btnBuy.setText("label");
		
		panelType = new JPanel();
		panelType.setLocation(new IntPoint(63, 36));
		panelType.setSize(new IntDimension(22, 17));
		panelType.setPreferredSize(new IntDimension(22, 17));
		
		//component layoution
		append(labelName);
		append(panelIcon);
		append(labelPrice);
		append(btnBuy);
		append(panelType);
		
		//-------------------------------
		
		btnBuy.wrapSimpleButton(Client.getUIElement("btn_mall_buy") as SimpleButton);
		btnBuy.setText("");
		var filter:GlowFilter;
		var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
		filter = new GlowFilter(0x000000, 1, 2, 2, 10);
		labelPrice.setForeground(ASColor.YELLOW);
		labelPrice.setFont(font);
		labelPrice.setTextFilters(new Array(filter));
		
		labelName.setForeground(ASColor.WHITE);
		labelName.setFont(font);
		labelName.setTextFilters(new Array(filter));
		
		btnBuy.addActionListener(onBtnBuy);
		this.setClipMasked(false);
		
		img_ingot_bg = new AssetBackground(Client.getUIElement("img_ingot_bg") as DisplayObject);
		img_money_bg = new AssetBackground(Client.getUIElement("img_money_bg") as DisplayObject);
		
		panelType.setBackgroundDecorator(img_ingot_bg);
		
		
		
	}

	private var img_ingot_bg:AssetBackground = null;
	private var img_money_bg:AssetBackground = null;
	public function set item(val:Object):void
	{
		_item = val;
		labelPrice.setText("");
		labelName.setText("");
		btnBuy.visible = false;
		panelType.setBackgroundDecorator(null);
		panelIcon.item = null;
		if(_item == null)
		{
			return;
		}
		if(_item.item_id <= 0)
		{
			return;
		}
		var objItemCSV:Object = Client.getInstance().GetItemCSV(_item.item_id);
		if(objItemCSV == null)
		{
			return;
		}


		if(FrameMall._mall_type == FrameMall.MALL_TYPE_INGOT)
			panelType.setBackgroundDecorator(img_ingot_bg);
		if(FrameMall._mall_type == FrameMall.MALL_TYPE_MONEY)
			panelType.setBackgroundDecorator(img_money_bg);
		if(FrameMall._mall_type == FrameMall.MALL_TYPE_HONOUR)
			panelType.setBackgroundDecorator(null);
		
		labelName.setText(objItemCSV.name);
		panelIcon.item = objItemCSV;//Client.getInstance().GetItemCSV(_item.item_id);//_item;
		labelPrice.setText(_item.price.toString());
		btnBuy.visible = true;
		pack();
		this.paintImmediately();
	}
	public function get item():Object
	{
		return _item;
	}
	private function onBtnBuy(e:Event):void
	{
		//PanelMain.showInfoTimeLimit("商店购买功能暂未开放!");
		//return;
		var csv_id:int = _item.csv_id;
		Client.getInstance().sendPacketLogic(700,[FrameMall._mall_type,csv_id,1]);
		trace("onBtnBuy:"+_item.csv_id);
	}
	
	public function clear():void
	{
		setBackgroundDecorator(null);
		btnBuy.wrapSimpleButton(new SimpleButton);
		item = null;
	}
	
	/*for each(var item:Object in CharInfo.m_arItemPage[0])
	{
		if(item.csv_id != 0)
		{
			var objItemCSV:Object = Client.getInstance().GetItemCSV(item.csv_id);
			_itemsEquip[nIndex].icon_id = objItemCSV.icon_id;
			
			if(_tooltipsEquip[nIndex] == null)
				_tooltipsEquip[nIndex] = new ToolTipItem(item);
			else
				_tooltipsEquip[nIndex].setItem(item);
			_tooltipsEquip[nIndex].setTargetComponent(_itemsEquip[nIndex]);
		}
		else
		{
			_itemsEquip[nIndex].icon_id = 0;
			if(_tooltipsEquip[nIndex] != null)
				_tooltipsEquip[nIndex].setTargetComponent(null);
		}
		//trace("setData,_items[nIndex].icon_id:"+_items[nIndex].icon_id);
		updateIcon(_itemsEquip[nIndex]);
		nIndex++;
		if(nIndex >= 16)
			break;
	}*/
	
}
